﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ChatApp.Core.Info;
using ChatApp.Models;

namespace ChatApp.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var aMessage = new ChatApp.Models.Message();

            if (Session["UserInfo"] == null)
                return RedirectToAction("Login", "User");
            var aUserInfo = (UserInfo) Session["UserInfo"];

            var lUserInfo = aMessage.GetCountMessage(aUserInfo.UserId);

            ViewBag.CountUser = lUserInfo.Count;
            ViewBag.ListUserSend = lUserInfo;
            ViewBag.Message = aUserInfo;
            return View();
        }

        //public ActionResult About()
        //{
        //    ViewBag.Message = "Your app description page.";

        //    return View();
        //}

        //public ActionResult Contact()
        //{
        //    ViewBag.Message = "Your contact page.";

        //    return View();
        //}
    }
}
